<%@page import="day9.Calculator"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>计算器</title>
</head>
<body style="text-align: center;">

	<jsp:useBean id="calculator" class="day9.Calculator"></jsp:useBean>
	<jsp:setProperty property="*" name="calculator" />
	<%
		calculator.calculator();
	%>
	计算结果是：
	<jsp:getProperty property="firstNum" name="calculator" />
	<jsp:getProperty property="operator" name="calculator" />
	<jsp:getProperty property="secondNum" name="calculator" />
	=
	<jsp:getProperty property="result" name="calculator" />
	<br>
	<hr>
	<br>
	<form action="/day9/calculator.jsp">
		<table border="1" width="50%">
			<tr>
				<td colspan="2">简单计算器</td>
			</tr>
			<tr>
				<td>第一个数</td>
				<td><input type="text" name="firstNum"></td>
			</tr>
			<tr>
				<td>运算符</td>
				<td><select name="operator">
						<option value="+">+</option>
						<option value="-">-</option>
						<option value="*">*</option>
						<option value="/">/</option>
				</select></td>
			</tr>
			<tr>
				<td>第二个数</td>
				<td><input type="text" name="secondNum"></td>
			</tr>
			<tr>
				<td>计算</td>
				<td><input type="submit" value="计算"></td>
			</tr>
		</table>
	</form>
</body>
</html>